Auth For Demo App

62 views
Skip to first unread message

Mir Harding

unread,
Oct 25, 2021, 2:41:35 PM10/25/21
to Freesound API
Good Afternoon,

I'm a software engineering student using the freesound api for a demo project for school. I wanted to include an upload/download fetaure to my app but I haven't started building it yet.

I just wanted to confirm the best course of action is to apply for regular auth token and then once I build out my POST routes for uploading/downloading I would go ahead and apply for O2Auth tp finish building these features?

Thank you
-Mir

Frederic Font Corbera

unread,
Oct 26, 2021, 5:09:30 AM10/26/21
to freeso...@googlegroups.com
Hi Mir,

The regular api keys can be used as well to carry out the OAuth2 process authentication, you don't need to apply for different keys. You'll find the process described in detail in the documentation: https://freesound.org/docs/api/authentication.html

Best,

frederic

--
Frederic Font - ffont.github.io
Music Technology Group, UPF - mtg.upf.edu
Freesound - freesound.org



--

---
You received this message because you are subscribed to the Google Groups "Freesound API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freesound-ap...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/freesound-api/441e6069-5ae3-4de5-ba05-e43d17ef6eb3n%40googlegroups.com.

Mir Harding

unread,
Oct 27, 2021, 4:11:28 PM10/27/21
to Freesound API

Awesome thank you!

Mir Harding

unread,
Nov 9, 2021, 3:52:15 PM11/9/21
to Freesound API
Good Afternoon,

I have additional questions regarding OAuth2. When the user grants access to my app, in the response is there any user information? For example when they grant access would I be able to get their username and email? Things you generally would want to log into a database as a user reference. Or would I have to have them register for my app then grant access through the Freesound API to use POST features? 


My other question is:

In step 3 it lists a curl example  for the URL request

curl -X POST -d "client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&code=THE_GIVEN_CODE"https://freesound.org/apiv2/oauth2/access_token/

However I am using Flask for this application. Would I instead put the client ID and secret key after the access token URL? 

EX:


Thank you so much for your time
- Miranda 




Frederic Font Corbera

unread,
Nov 10, 2021, 4:17:53 AM11/10/21
to freeso...@googlegroups.com
Hi,

The response which give you the access token does not include user information, but you can then use this access token to access the resource https://freesound.org/apiv2/me which will return information to uniquely identify the authenticated user.

Here is a Python Flask example of doing the full OAuth2 flow to authenticate users with Freesound API: https://gist.github.com/ffont/3607ba4af9814f3877cd42894a564222

frederic

--
Frederic Font - ffont.github.io
Music Technology Group, UPF - mtg.upf.edu
Freesound - freesound.org


Mir Harding

unread,
Nov 10, 2021, 7:34:09 AM11/10/21
to freeso...@googlegroups.com
Thank you so much for this!

You received this message because you are subscribed to a topic in the Google Groups "Freesound API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/freesound-api/Wv8pQxjdXxA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to freesound-ap...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/freesound-api/CABDPa_yO%3DCvsiNmKsT0-JOT9HNoRsb2G0ZrqcmH-RpScMDkjhg%40mail.gmail.com.

Mir Harding

unread,
Nov 12, 2021, 3:42:19 PM11/12/21
to Freesound API
I promise this is the last silly question regarding. It looks like my app is running into an error in the Authorization flow where it does not redirect to the callback. It says localhost cannot connect. Below are the screen and the callback URL for my credential. Does this mean I will have to use the method where the user copies and pastes the code into a POST route?



local host cannot be reached.PNGlogin callback.PNG
Thank you and Sincerely, 
Miranda

Frederic Font Corbera

unread,
Nov 14, 2021, 2:33:45 PM11/14/21
to freeso...@googlegroups.com
Hi,

It looks like Freesound is indeed doing the redirect, but no local server is listening at https://localhost/login/callback?
Maybe you're missing the port number? And also you will most likely be using http and not https in local development. You should put as a redirect address the same address you would use to access your local app server from your browser (plus the path /login/callback or whatever you're using). If you're application is Flask, maybe redirect URL should be http://localhost:5000/login/callback

Cheers,

frederic

--
Frederic Font - ffont.github.io
Music Technology Group, UPF - mtg.upf.edu
Freesound - freesound.org


Mir Harding

unread,
Nov 14, 2021, 2:38:56 PM11/14/21
to Freesound API
Thank you Frederic! I will check those things!

- Miranda
Reply all
Reply to author
Forward
0 new messages