finish generate and obtain invitation code