11from django .shortcuts import render
22from django .http import HttpResponse
3- from .models import Auth
43import requests
54import datetime
65
@@ -25,11 +24,8 @@ def auth(request):
2524 code = request .GET .get ('code' )
2625 context = request .GET .get ('context' )
2726 scope = request .GET .get ('scope' )
28- 29- # redirect = 'https://inventroman.herokuapp.com/cb/auth'
3027 redirect = config ('callBackURL' )
3128
32- 3329 store_hash = context .split ('/' )[1 ]
3430
3531 client = BigcommerceApi (client_id = client_id (), store_hash = config ('apiStoreHash' ))
@@ -38,14 +34,12 @@ def auth(request):
3834 bc_user_id = token ['user' ]['id' ]
3935 email = token ['user' ]['email' ]
4036 access_token = token ['access_token' ]
41- 42- a , created = Auth .objects .get_or_create (storehash = store_hash )
43- a .user_id = bc_user_id
44- a .mail = email
45- a .storehash = store_hash
46- a .token = access_token
47- a .save ()
37+ pp = request .build_absolute_uri ()
38+ print ('this is url ' + pp )
39+ # b = Auth.objects.create(user_id = bc_user_id ,mail = email, storehash = store_hash, token = access_token)
4840
49- return render (request , 'index .html' )
41+ return render (request , 'auth .html' )
5042
5143 return HttpResponse ("Something Went Wrong" )
44+ 45+
0 commit comments