Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by xtplpune · May 30, 2012 at 11:26 AM · serverhttp

how to post a data to the server ?

Hi, i want to Post a request for getting the access token. how to send the request to Server.

With curl, the request will be similar to:

curl https://api.betable.com/1.0/token \ -u ApI_Key:ApI_Secret \ -d code=code_you_got_back \ -d grant_type=authorization_code \ -d redirect_uri=http://your-redirect-uri/ \ -X POST

here i have Api _Secret,code,redirect url every thing. but by using java script how to write the condition ?

what is this curl method ?

Thank you,

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Logistic Win Software · Aug 21, 2013 at 04:05 AM

Can I get your assistance with integrating Betable in a Unity Project? This is a HUGE deal for me and I need some help.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by whydoidoit · May 30, 2012 at 11:27 AM

Best thing to do is look at this documentation for WWWForm http://unity3d.com/support/documentation/ScriptReference/WWWForm.html

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image xtplpune · May 30, 2012 at 11:34 AM 0
Share

Thanks for ur reply. i want to solve this Step-4. Step 4: Exchange the code for an access token

The code we sent you back in step 3 can be redeemed for a user access token. Just like at an arcade.

This time you should make a secure server-side call, which will include your client_secret, so we’re sure the request comes from you. You should use HTTP Basic Authentication in this call, using your API $$anonymous$$EY as username and your API SECRET as password.

The URI to send the request to will look like this:

POST https://api.betable.com/1.0/token The body of the request will need the following parameters, url-encoded:

grant_type=authorization_code redirect_uri=YOUR_REDIRECT_URI code=CODE_YOU_GOT_ON_STEP_3 Parameter Required Description redirect_uri Yes This must be the same value as what you defined in the developer dashboard. We won't do anything with it at this time, but this is required for security reasons by the OAuth spec. code Yes This is the code that you got back in Step 3. Without this we would not know what user you want an access_token for, so it's pretty important.' grant_type Yes This must be set to authorization_code, as required by the OAuth spec. With curl, the request will be similar to:

curl https://api.betable.com/1.0/token \ -u ApI_$$anonymous$$ey:ApI_Secret \ -d code=code_you_got_back \ -d grant_type=authorization_code \ -d redirect_uri=http://your-redirect-uri/ \ -X POST In Ruby, the call will look like this:

url = URI.parse('https://api.betable.com/1.0/token') req = Net::HTTP::Post.new(url.path) req.set_form_data( { :grant_type => 'authorization_code', :code => params[:code], :redirect_uri => "http://localhost:4567/callback" }) req.basic_auth 'ApI_$$anonymous$$ey', 'ApI_SecRet' http = Net::HTTP.new(url.host, url.port) http.use_ssl = true response = http.request(req) You should then parse the response that you will get from Betable. The body of the response will be a url-encoded string that will include the final access_token.

access_token=USER_ACESS_TO$$anonymous$$EN&token_type=Bearer This access_token will enable you to make bet requests on behalf of the user, so you should be persisting the token in order to make requests even after the user’s first visit.

For security reasons, our tokens expire after a period of time. At that point, you should re-initiate the flow from step 1. If the user has not deauthorized your app in the meantime, he will not be shown the authorization request and we will automatically send you a new code that you can exchange for a new access_token.

If there is a problem validating the code or creating an access_token, we will issue an HTTP 400 error and return a response with JSON in the body explaining what went wrong. It could look like this:

{ "error": { "type": "OAuthException", "message": "Validation of the code failed." } }

avatar image whydoidoit · May 30, 2012 at 11:38 AM 0
Share

Yeah OAuth is a pig :) I've done if from web sites, but I use www.Prime31.com to do my social integration from the device.

avatar image
0

Answer by ina · Jul 21, 2013 at 02:02 AM

curl params via Unity WWWForm

  • WWWForm.headers should help with the basic auth.

  • this is just WWWForm data

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

unity + amf 0 Answers

Unity networking tutorial? 6 Answers

Can't Send a form to a server(POST) due to CORS error in a WEBGL build 1 Answer

Internet Connection Check using 204 HTTPStatusCode 1 Answer

Create a simple http server on the streaming asset folder for access it via http://localhost:*port*/ on Browser 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges