Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the token and id? #4

Open
Lay4949 opened this issue Apr 23, 2023 · 7 comments
Open

How to get the token and id? #4

Lay4949 opened this issue Apr 23, 2023 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@Lay4949
Copy link

Lay4949 commented Apr 23, 2023

Hello,I am a student. I want to know how to get the token and org_id.Thank you so much!

@gchoumos gchoumos self-assigned this Apr 25, 2023
@gchoumos gchoumos added the question Further information is requested label Apr 25, 2023
@gchoumos
Copy link
Owner

Hello @Lay4949 !

Thanks for your interest in this repository!

To use the Mapillary API, you have to create an account on the Mapillary platform, and then register an application that will be automatically assigned a token. This is the token that the scripts expect to have configured so that they are "allowed" to talk to the Mapillary API.

I suggest that you go through this section of the Mapillary documentation (link), which will shed some light on the steps to follow!

Let me know if you need to have further help after reading the above!

Assigning this ticket back to you for visibility :)

Thanks,
George

@gchoumos gchoumos assigned Lay4949 and unassigned gchoumos Apr 25, 2023
@kauevestena
Copy link

hey @Lay4949 please don't send your token publicly, one can use it to do things on your name... In the specific case of mapillary I don't think that there's really bad things that could be done with it... It is a general security measure, because the token is the authorization for your account for the API, as your login/password is for the platform

Repository owner deleted a comment from Lay4949 Apr 26, 2023
@gchoumos
Copy link
Owner

gchoumos commented Apr 26, 2023

Hey @Lay4949 ,

As @kauevestena pointed out (and thank you very much for that!), it is better to avoid having your token publicly available. I initially edited the comment, but the edit history is still public, so I eventually deleted it! Sorry about that, this is just as a pre-caution for you! :)

Will get back to you with a response soon!

Thanks a lot both of you!

George

@Lay4949
Copy link
Author

Lay4949 commented May 4, 2023

Hello,@gchoumos. Is there anything wrong with my operation to get the token? It doesn't seem to return the information it should have.
I got authorization_code according to the tutorial and configured the parameters according to the following official format, but it seems that I didn't return the expected results.
curl https://graph.mapillary.com/token
-H "Content-Type: application/json"
-H "Authorization: OAuth CLIENT_SECRET"
-d'
{
"grant_type": "authorization_code",
"code": "LONG_AUTHORIZATION_CODE",
"client_id": CLIENT_ID
}'

The following is what I used:
curl https://graph.mapillary.com/token ^
-H "Content-Type: application/json" ^
-H "Authorization: MLY|**********|*****************" ^
-d'^
{^
"grant_type": "authorization_code",^
"code": "code=AQCeBGRm2jvbYDF55VZlDplKd30ABOKAllaqcgk48TqbZ2L25BPl8qDMub4WzSbR1Ciw7xodwfCaXNhGOJB7sPJE9xHaaoIkZIEMFIBS5hBThJAtys6lnu07_-DxCf5kWPsC5yWAPGP0QOiQiAa4GC2aDpr8eINP23JJUPpzhiM2rIRTkkl34uzus5H_QcNc0jEGizLEH9FddVUpafdoNFkZlBmMNKSYmyq7Lf3gWmAGVLuhLU5MXAL2Cx_nt249YCK7ShRlyzcsxGpY_D_cA8s1SfCsYktj8MA3aO6vaHdcQ",^
"client_id": **********
}'

@gchoumos
Copy link
Owner

gchoumos commented May 4, 2023

Hello @Lay4949 !

Is this an error that occurs through running any of the scripts provided in this repository? Or is this a standalone curl command that you are attempting to run?

Normally, if you configure your access_token (the one that looks like MLY|******|**********) in the settings.py file, the scripts should run with no issue.

If you are running a standalone curl, and not through the scripts, it will be a bit difficult for me to support you. Could you try doing this through the scripts, and by setting the "MLY" token in settings? It is the token item of the relevant dictionary, where a dummy value is provided by default.

SETTINGS = {
   ...
    'img_meta_out_file': 'img_meta_dataset.csv', # images with metadata
    'detections_out_file': 'img_detections_dataset.csv', # detections of images
    'token': 'MLY|1234567890123456|1234567890abcdef1234567890abcdef', <<<<<< Change this!
    'min_zoom': 13,
   ...

Hope that helps :)

George

@Lay4949
Copy link
Author

Lay4949 commented May 4, 2023

Thank you very much for reminding me.

@Lay4949
Copy link
Author

Lay4949 commented May 4, 2023

Sorry, I haven't got access_token yet. What I'm doing now is calls the token endpoint with the authorization code to exchange for the user access token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants